package org.pzy.dubbo.consumer;

import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.pzy.dubbo.api.GreetingService;

/**
 * @Author: DRevelation
 * @Date: 2022/6/1 10:11
 * 本地zookeeper连得上，就虚拟机里的连不上，zoolytic都可以连上虚拟机里的
 */
public class Application {
    public static void main(String[] args) {
        ReferenceConfig<GreetingService> config = new ReferenceConfig<>();
        config.setApplication(new ApplicationConfig("first-dubbo-consumer"));
        config.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
        config.setInterface(GreetingService.class);
        GreetingService greetingService = config.get();
        String sayHi = greetingService.sayHi("dubbo");
        System.out.println(sayHi);
    }
}
